home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / LocationManager.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  11.0 KB  |  368 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        LocationManager.h
  3.  
  4.      Contains:    LocationManager (manages groups of settings)
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __LOCATIONMANAGER__
  18. #define __LOCATIONMANAGER__
  19.  
  20. #ifndef __APPLEEVENTS__
  21.     #include <AppleEvents.h>
  22. #endif
  23.  
  24. #ifndef __COMPONENTS__
  25.     #include <Components.h>
  26. #endif
  27.  
  28. #ifndef __DIALOGS__
  29.     #include <Dialogs.h>
  30. #endif
  31.  
  32. #ifndef __PROCESSES__
  33.     #include <Processes.h>
  34. #endif
  35.  
  36. #ifndef __STANDARDFILE__
  37.     #include <StandardFile.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. /* Location Manager API Support -------------------------------------------------------------------- */
  64. /* A Location Token uniquely identifies a Location on a machine... */
  65.  
  66. typedef struct OpaqueALMToken*             ALMToken;
  67. #define kALMNoLocationToken    ((ALMToken)(-1))  // ALMToken of "off" Location...
  68. enum {
  69.     kALMLocationNameMaxLen        = 31,                            /* name (actually imposed by file system)... */
  70.     kALMNoLocationIndex            = -1                            /* index for the "off" Location (kALMNoLocationToken)... */
  71. };
  72.  
  73. typedef Str31                             ALMLocationName;
  74. /* Returned from ALMConfirmName... */
  75.  
  76. typedef SInt16 ALMConfirmChoice;
  77. enum {
  78.     kALMConfirmRename            = 1,
  79.     kALMConfirmReplace            = 2
  80. };
  81.  
  82. /* ALMConfirmName dialog item numbers for use in callbacks (ALM 2.0)... */
  83.  
  84. enum {
  85.     kALMDuplicateRenameButton    = 1,                            /* if Window refcon is kALMDuplicateDialogRefCon... */
  86.     kALMDuplicateReplaceButton    = 2,
  87.     kALMDuplicateCancelButton    = 3,
  88.     kALMDuplicatePromptText        = 5
  89. };
  90.  
  91. enum {
  92.     kALMRenameRenameButton        = 1,                            /* if Window refcon is kALMRenameDialogRefCon... */
  93.     kALMRenameCancelButton        = 2,
  94.     kALMRenameEditText            = 3,
  95.     kALMRenamePromptText        = 4
  96. };
  97.  
  98. /* Refcons of two windows in ALMConfirmName (ALM 2.0)... */
  99.  
  100. enum {
  101.     kALMDuplicateDialogRefCon    = FOUR_CHAR_CODE('dupl'),
  102.     kALMRenameDialogRefCon        = FOUR_CHAR_CODE('rnam')
  103. };
  104.  
  105. /* Callback routine for Location awareness (mimics AppleEvents) in non-application code... */
  106.  
  107. typedef CALLBACK_API( void , ALMNotificationProcPtr )(AppleEvent *theEvent);
  108. typedef STACK_UPP_TYPE(ALMNotificationProcPtr)                     ALMNotificationUPP;
  109. #if OPAQUE_UPP_TYPES
  110.     EXTERN_API(ALMNotificationUPP)
  111.     NewALMNotificationUPP           (ALMNotificationProcPtr    userRoutine);
  112.  
  113.     EXTERN_API(void)
  114.     DisposeALMNotificationUPP       (ALMNotificationUPP        userUPP);
  115.  
  116.     EXTERN_API(void)
  117.     InvokeALMNotificationUPP       (AppleEvent *            theEvent,
  118.                                     ALMNotificationUPP        userUPP);
  119.  
  120. #else
  121.     enum { uppALMNotificationProcInfo = 0x000000C0 };                 /* pascal no_return_value Func(4_bytes) */
  122.     #define NewALMNotificationUPP(userRoutine)                         (ALMNotificationUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppALMNotificationProcInfo, GetCurrentArchitecture())
  123.     #define DisposeALMNotificationUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  124.     #define InvokeALMNotificationUPP(theEvent, userUPP)             CALL_ONE_PARAMETER_UPP((userUPP), uppALMNotificationProcInfo, (theEvent))
  125. #endif
  126. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  127. #define NewALMNotificationProc(userRoutine)                     NewALMNotificationUPP(userRoutine)
  128. #define CallALMNotificationProc(userRoutine, theEvent)            InvokeALMNotificationUPP(theEvent, userRoutine)
  129. /* Notification AppleEvents sent to apps/registered code...  */
  130. enum {
  131.     kAELocationChangedNoticeKey    = FOUR_CHAR_CODE('walk'),        /* Current Location changed... */
  132.     kAELocationRescanNoticeKey    = FOUR_CHAR_CODE('trip')        /* Location created/renamed/deleted... */
  133. };
  134.  
  135. /* ALMSwitchToLocation masks... */
  136.  
  137. typedef SInt32 ALMSwitchActionFlags;
  138. enum {
  139.     kALMDefaultSwitchFlags        = 0x00000000,                    /* No special action to take... */
  140.     kALMDontShowStatusWindow    = 0x00000001,                    /* Suppress "switching" window... */
  141.     kALMSignalViaAE                = 0x00000002                    /* Switch by sending Finder AppleEvent... */
  142. };
  143.  
  144. /* Parameters for Get/Put/Merge Location calls... */
  145.  
  146. typedef const OSType *                    ConstALMModuleTypeListPtr;
  147. enum {
  148.     kALMAddAllOnSimple            = 0,                            /* Add all single-instance, non-action modules... */
  149.     kALMAddAllOff                = -1                            /* Add all modules but turn them off... */
  150. };
  151.  
  152. /* Item numbers for use in Get/Put/Merge Location filters... */
  153.  
  154. enum {
  155.     kALMLocationSelectButton    = 1,
  156.     kALMLocationCancelButton    = 2,
  157.     kALMLocationBalloonHelp        = 3,
  158.     kALMLocationLocationList    = 7,
  159.     kALMLocationLocationNameEdit = 10,
  160.     kALMLocationPromptText        = 11
  161. };
  162.  
  163. enum {
  164.     kALMLocationSaveButton        = kALMLocationSelectButton
  165. };
  166.  
  167. /* Location Manager Module API Support ------------------------------------------------------------- */
  168.  
  169. /* ALMGetScriptInfo stuff... */
  170.  
  171. enum {
  172.     kALMScriptInfoVersion        = 2                                /* Customarily put in resource for localization... */
  173. };
  174.  
  175.  
  176. struct ALMScriptManagerInfo {
  177.     SInt16                             version;                    /* Set to kALMScriptInfoVersion... */
  178.     SInt16                             scriptCode;
  179.     SInt16                             regionCode;
  180.     SInt16                             langCode;
  181.     SInt16                             fontNum;
  182.     SInt16                             fontSize;
  183. };
  184. typedef struct ALMScriptManagerInfo        ALMScriptManagerInfo;
  185. typedef ALMScriptManagerInfo *            ALMScriptManagerInfoPtr;
  186. /*
  187.    Alternate form of ScriptInfo is easier to localize in resources; it is used extensively in
  188.    samples and internally, so....
  189. */
  190.  
  191. struct ALMAltScriptManagerInfo {
  192.     SInt16                             version;
  193.     SInt16                             scriptCode;
  194.     SInt16                             regionCode;
  195.     SInt16                             langCode;
  196.     SInt16                             fontSize;
  197.     Str63                             fontName;
  198. };
  199. typedef struct ALMAltScriptManagerInfo    ALMAltScriptManagerInfo;
  200. typedef ALMAltScriptManagerInfo *        ALMAltScriptManagerInfoPtr;
  201. typedef ALMAltScriptManagerInfoPtr *    ALMAltScriptManagerInfoHandle;
  202. enum {
  203.     kALMAltScriptManagerInfoRsrcType = FOUR_CHAR_CODE('trip'),
  204.     kALMAltScriptManagerInfoRsrcID = 0
  205. };
  206.  
  207. /* Reboot information used on ALMSetCurrent (input/output parameter)... */
  208.  
  209. typedef UInt32 ALMRebootFlags;
  210. enum {
  211.     kALMNoChange                = 0,
  212.     kALMAvailableNow            = 1,
  213.     kALMFinderRestart            = 2,
  214.     kALMProcesses                = 3,
  215.     kALMExtensions                = 4,
  216.     kALMWarmBoot                = 5,
  217.     kALMColdBoot                = 6,
  218.     kALMShutdown                = 7
  219. };
  220.  
  221. /*
  222.    File types and signatures...
  223.    Note: auto-routing of modules will not be supported for 'thng' files...
  224. */
  225.  
  226. enum {
  227.     kALMFileCreator                = FOUR_CHAR_CODE('fall'),        /* Creator of Location Manager files... */
  228.     kALMComponentModuleFileType    = FOUR_CHAR_CODE('thng'),        /* Type of a Component Manager Module file [v1.0]... */
  229.     kALMComponentStateModuleFileType = FOUR_CHAR_CODE('almn'),    /* Type of a CM 'state' Module file... */
  230.     kALMComponentActionModuleFileType = FOUR_CHAR_CODE('almb'),    /* Type of a CM 'action' Module file... */
  231.     kALMCFMStateModuleFileType    = FOUR_CHAR_CODE('almm'),        /* Type of a CFM 'state' Module file... */
  232.     kALMCFMActionModuleFileType    = FOUR_CHAR_CODE('alma')        /* Type of a CFM 'action' Module file... */
  233. };
  234.  
  235. /* Component Manager 'thng' info... */
  236.  
  237. enum {
  238.     kALMComponentRsrcType        = FOUR_CHAR_CODE('thng'),
  239.     kALMComponentType            = FOUR_CHAR_CODE('walk')
  240. };
  241.  
  242. /* CFM Modules require a bit of information (replacing some of the 'thng' resource)... */
  243.  
  244. enum {
  245.     kALMModuleInfoRsrcType        = FOUR_CHAR_CODE('walk'),
  246.     kALMModuleInfoOriginalVersion = 0
  247. };
  248.  
  249. /* These masks apply to the "Flags" field in the 'thng' or 'walk' resource... */
  250.  
  251. enum {
  252.     kALMMultiplePerLocation        = 0x00000001,                    /* Module can be added more than once to a Location... */
  253.     kALMDescriptionGetsStale    = 0x00000002                    /* Descriptions may change though the setting didn't...  */
  254. };
  255.  
  256. /* Misc stuff for older implementations ------------------------------------------------------------ */
  257.  
  258. #if OLDROUTINENAMES
  259. /* Old error codes for compatibility - new names are in Errors interface... */
  260. enum {
  261.     ALMInternalErr                = -30049,                        /* use kALMInternalErr */
  262.     ALMLocationNotFound            = -30048,                        /* use kALMLocationNotFoundErr */
  263.     ALMNoSuchModuleErr            = -30047,                        /* use kALMNoSuchModuleErr */
  264.     ALMModuleCommunicationErr    = -30046,                        /* use kALMModuleCommunicationErr */
  265.     ALMDuplicateModuleErr        = -30045,                        /* use kALMDuplicateModuleErr */
  266.     ALMInstallationErr            = -30044,                        /* use kALMInstallationErr */
  267.     ALMDeferSwitchErr            = -30043                        /* use kALMDeferSwitchErr */
  268. };
  269.  
  270. /* Old ALMConfirmName constants... */
  271.  
  272. enum {
  273.     ALMConfirmRenameConfig        = kALMConfirmRename,
  274.     ALMConfirmReplaceConfig        = kALMConfirmReplace
  275. };
  276.  
  277. /* Old AppleEvents... */
  278.  
  279. enum {
  280.     kAELocationNotice            = kAELocationChangedNoticeKey
  281. };
  282.  
  283.  
  284. typedef ALMScriptManagerInfo             ALMScriptMgrInfo;
  285. typedef UInt32                             ALMComponentFlagsEnum;
  286. #endif  /* OLDROUTINENAMES */
  287.  
  288. /* Location Manager API ---------------------------------------------------------------------------- */
  289.  
  290. /* The following 7 routines are present if gestaltALMAttr has bit gestaltALMPresent set... */
  291.  
  292. EXTERN_API( OSErr )
  293. ALMGetCurrentLocation            (SInt16 *                index,
  294.                                  ALMToken *                token,
  295.                                  ALMLocationName         name)                                THREEWORDINLINE(0x303C, 0x0600, 0xAAA4);
  296.  
  297. EXTERN_API( OSErr )
  298. ALMGetIndLocation                (SInt16                 index,
  299.                                  ALMToken *                token,
  300.                                  ALMLocationName         name)                                THREEWORDINLINE(0x303C, 0x0501, 0xAAA4);
  301.  
  302. EXTERN_API( OSErr )
  303. ALMCountLocations                (SInt16 *                locationCount)                        THREEWORDINLINE(0x303C, 0x0202, 0xAAA4);
  304.  
  305. EXTERN_API( OSErr )
  306. ALMSwitchToLocation                (ALMToken                 newLocation,
  307.                                  ALMSwitchActionFlags     switchFlags)                        THREEWORDINLINE(0x303C, 0x0403, 0xAAA4);
  308.  
  309. EXTERN_API( OSErr )
  310. ALMRegisterNotifyProc            (ALMNotificationUPP     notificationProc,
  311.                                  const ProcessSerialNumber * whichPSN)                        THREEWORDINLINE(0x303C, 0x0404, 0xAAA4);
  312.  
  313. EXTERN_API( OSErr )
  314. ALMRemoveNotifyProc                (ALMNotificationUPP     notificationProc,
  315.                                  const ProcessSerialNumber * whichPSN)                        THREEWORDINLINE(0x303C, 0x0405, 0xAAA4);
  316.  
  317. EXTERN_API( OSErr )
  318. ALMConfirmName                    (ConstStr255Param         message,
  319.                                  Str255                 theName,
  320.                                  ALMConfirmChoice *        choice,
  321.                                  ModalFilterUPP         filter)                                THREEWORDINLINE(0x303C, 0x0806, 0xAAA4);
  322.  
  323. /* The following 3 routines are present if gestaltALMAttr has bit gestaltALMHasSFLocation set... */
  324.  
  325. EXTERN_API( OSErr )
  326. ALMPutLocation                    (ConstStr255Param         prompt,
  327.                                  ALMLocationName         name,
  328.                                  SInt16                 numTypes,
  329.                                  ConstALMModuleTypeListPtr  typeList,
  330.                                  ModalFilterYDUPP         filter,
  331.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0B07, 0xAAA4);
  332.  
  333. EXTERN_API( OSErr )
  334. ALMGetLocation                    (ConstStr255Param         prompt,
  335.                                  ALMLocationName         name,
  336.                                  ModalFilterYDUPP         filter,
  337.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0808, 0xAAA4);
  338.  
  339. EXTERN_API( OSErr )
  340. ALMMergeLocation                (ConstStr255Param         prompt,
  341.                                  ALMLocationName         name,
  342.                                  SInt16                 numTypes,
  343.                                  ConstALMModuleTypeListPtr  typeList,
  344.                                  ModalFilterYDUPP         filter,
  345.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0B09, 0xAAA4);
  346.  
  347.  
  348. #if PRAGMA_STRUCT_ALIGN
  349.     #pragma options align=reset
  350. #elif PRAGMA_STRUCT_PACKPUSH
  351.     #pragma pack(pop)
  352. #elif PRAGMA_STRUCT_PACK
  353.     #pragma pack()
  354. #endif
  355.  
  356. #ifdef PRAGMA_IMPORT_OFF
  357. #pragma import off
  358. #elif PRAGMA_IMPORT
  359. #pragma import reset
  360. #endif
  361.  
  362. #ifdef __cplusplus
  363. }
  364. #endif
  365.  
  366. #endif /* __LOCATIONMANAGER__ */
  367.  
  368.